package com.zxm.ssm.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zxm.ssm.entity.Inform;
import com.zxm.ssm.mapper.InformMapper;
import com.zxm.ssm.service.InformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class InformServiceImpl implements InformService {

    @Autowired
    private InformMapper informMapper;

    @Override
    public PageInfo<Inform> findAllInform(int pagNum, int pagSize) {
        PageHelper.startPage(pagNum, pagSize);
        PageInfo<Inform> pageInfo = new PageInfo<Inform>(informMapper.findAll());
        return pageInfo;
    }


    @Override
    public Integer addInform(Inform inform) {
        return informMapper.addInform(inform);
    }

    @Override
    public Integer updateInform(Inform inform) {
        return informMapper.updateInform(inform);
    }

    @Override
    public Integer deleteInformById(Integer id) {
        return informMapper.deleteInformById(id);
    }


    @Override
    public PageInfo<Inform> selectInformAll(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Inform> Inform = informMapper.selectInformAll();
        PageInfo<Inform> pageInfo = new PageInfo<>(Inform);
        return pageInfo;
    }

    @Override
    public Inform findInformById(Integer id) {
        return informMapper.findInformById(id);
    }
}
